#ifndef _gl_extensions_h_
#define _gl_extensions_h_

// zawiera glext.h
#include "sdl_my_opengl.h"

#if !defined(WIN32)
#include "GL/glx.h"
#include "GL/glxext.h"
#else
#include "wingdi.h"
#endif
#include "gl_supported.h"
#include "sdl_debug.h"
#include <cstring>

/*
 * Deklaracje funkcji z rozszerzeń, które wykorzystujemy
 */

#if !defined(GL_GLEXT_PROTOTYPES)
extern PFNGLGENBUFFERSARBPROC glGenBuffers;
extern PFNGLDELETEBUFFERSARBPROC glDeleteBuffers;
extern PFNGLBINDBUFFERARBPROC glBindBuffer;
extern PFNGLBUFFERDATAARBPROC glBufferData;
extern PFNGLBUFFERSUBDATAARBPROC glBufferSubData;
extern PFNGLMAPBUFFERARBPROC glMapBuffer;
extern PFNGLUNMAPBUFFERARBPROC glUnmapBuffer;
extern PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements;

extern PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTexture;
extern PFNGLMULTITEXCOORD1FARBPROC glMultiTexCoord1f;
extern PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2f;
extern PFNGLMULTITEXCOORD3FARBPROC glMultiTexCoord3f;
extern PFNGLMULTITEXCOORD4FARBPROC glMultiTexCoord4f;
extern PFNGLACTIVETEXTUREARBPROC glActiveTexture;
#endif //GL_GLEXT_PROTOTYPES

template<class glfunc>
glfunc sdl_gl_getproc(const char * name) {
#ifdef WIN32
    return (glfunc) wglGetProcAddress((LPCSTR) (name));
#else
    return (glfunc) glXGetProcAddress((const GLubyte *) (name));
#endif
}

extern void sdl_load_gl_extensions();

#endif //_gl_extensions_h_
